
  <link rel="stylesheet" type="text/css" href="{$_G['URL']['LOTTERY_CSS']}lottery/css/reset.css">
  <link rel="stylesheet" type="text/css" href="{$_G['URL']['LOTTERY_CSS']}lottery/css/swiper.min.css">
  <link rel="stylesheet" type="text/css" href="{$_G['URL']['LOTTERY_CSS']}lottery/css/style.css?v=11">

  <script src="{$_G['URL']['LOTTERY_CSS']}lottery/js/layer/layer.js"></script>
  <style type="text/css">
    .fixBottom{
      z-index: 2;
    }
    .strategy .statTxt{
      width: 3.83rem !important;
    }
    .timeEnd12{
      padding-top: .16rem !important;
    }
    .myWinner .timeEnd12{
      padding: 0 0.16rem!important;
	  margin-top: 0.2rem;
    }
	.winerChosen{
		padding: 0 0.43rem 0 0.34rem;
	}
	.dataBox{
		padding: 0;
      overflow: hidden;
	}
	.strategy li{
		margin: 0 0.26rem;
	}
	.strategy .f_list{
		background: #ffdaa2;
		padding: 0.2rem 0.5rem 0.14rem 0.1rem;
		margin: .2rem 0.26rem .2rem 0.9rem;
		/* margin: 0 0 0.2rem; */
		border-radius: 0.1rem;
		position: relative;
		height: 0.8rem;
		overflow: visible;
	}
	.strategy .f_list::after{
	  content: "";
	  display: block;
	  clear: both;
	  border: 0.2rem solid transparent;
	  border-bottom-color: #ffdaa2;
	  width: 0;
	  height: 0;
	  position: absolute;
	  top: -0.3rem;
	  left: 0.5rem;
	}
	.strategy .f_list:not(.li_np)>div,.strategy .f_list.li_np>div>div{
		height: 0.8rem;
		overflow: hidden;
		display: flex;
		justify-content: space-evenly;
	}
	.strategy .f_list.li_np{
		padding-right: 0.5rem;
	}
	.strategy .f_list>a,.strategy .f_list.li_np>div>a{
		background: #c98e4b;
		color: #ffdaa2;
		display: block;
		position: absolute;
		right: 0;
		top: 0;
		bottom: 0;
		width: 0.5rem;
		text-align: center;
		line-height: 0.5rem;
		writing-mode: vertical-lr;
		writing-mode: tb-lr;
		border-radius: 0 0.1rem 0.1rem 0;
	}
	.strategy .f_list .f_list_item{
		margin-right: 0.1rem;
		float: left;
		margin-bottom: 0.2rem;
	}
	.strategy .f_list.li_np .f_list_item .f_list_img_wrap{

			width: 0.72rem;
			height: 0.72rem;
	}
	.strategy .f_list .f_list_item .f_list_img_wrap{
		width: 0.76rem;
		height: 0.76rem;
		border-radius: 0.41rem;
		position: relative;

	}
	.strategy .f_list.li_np .f_list_item .f_list_img_wrap span{

			width: 0.68rem;
			height: 0.68rem;
	}
	.strategy .f_list .f_list_item .f_list_img_wrap span{
		line-height: 0.76rem;
		width: 0.72rem;
		height: 0.72rem;
		text-align: center;
		display: block;
		position: absolute;
		top: 0;
		left: 0;
		border: 0.02rem solid #c98e4b;
		border-radius: 0.41rem;
		color: #c98e4b;
	}
	.strategy .f_list .f_list_item>span{
		display: block;
		color: #c98e4b;
		text-align: center;
		margin-top: 0.1rem;
		font-size: 0.2rem;
	}
	.strategy .f_list.li_np .f_list_item .f_list_img_wrap img{
		width: 0.72rem;
		height: 0.72rem;
	}
	.strategy .f_list .f_list_item .f_list_img_wrap img{
		width: 0.76rem;
		height: 0.76rem;
		border-radius: 0.41rem;
	}
	.strategy .f_list .f_list_item .f_list_img_wrap img[src=""],.strategy .f_list .f_list_item .f_list_img_wrap img:not([src]){
		opacity:0;
	}
	.redbagTxt p{
		text-shadow: 0.04rem 0.06rem 0.07rem #ff6a69;
	}
    .redBag a.getBag{
      transform: none;
      position: static;
      height: 0.44rem;
      display: flex;
      justify-content: center;
      align-items: center;
      line-height: normal;
      margin: 0.1rem auto 0;
    }
    .redBag .redbagBtn{
      position: absolute;
      top: 0.26rem;
      /*bottom: 0.34rem;*/
      right: 0.24rem;
      text-align: center;
    }
    .redBag .redbagBtn span{
      transform: none;
      color: rgba(255,255,255,0.63);
      text-align: center;
      font-weight: bold;
    }
    .myGift{
      padding-top: 1.5rem;
    }
    .myGift div:first-child{
      margin-bottom: 0.12rem;
      font-weight: bold;
      font-size: 0.3rem;
    }
    .ticketBox .convert_code img{
      width: 100%!important;
      height: 100%!important;
    }
    .ticeketList ul {
      /*max-height: 7.3rem;*/
    }
    .yx_peopleList li{
      padding-left: 0.3rem;
      padding-right: 0.3rem;
    }
    .myWinner .yx_choseBar.yx_peopleList{
      position: absolute;
      bottom: 0;
      top: 2.29rem;
      left:0.34rem;
      right:0.43rem;
    }
    .myWinner .ticeketList{
      position: absolute;
      top: 0;
      bottom: 0;
      display: flex;
      left:0;
      right:0;
      flex-direction: column;
    }
    .redBag{
      overflow: visible;
    }


    .redWrap{
      z-index: 1;
      background: url(https://dpy01cdn.yixuan.net/images/2/2021/08/vxTXaa2rwtBATA2LlJXVjIXXMbaJ5p.png) no-repeat -0.08rem top;
      background-size: 100% auto;
      position: relative;
    }
    .redWrap .h{
      color: #a66e4d;
      display: flex;
      justify-content: center;
      align-items: center;
      padding-top: 0.4rem;
    }
    .redWrap .h div{
      position: relative;
    }
    .redWrap .h text{
      width: 0.11rem;
      height: 0.11rem;
      border-radius: 0.11rem;
      border: 0.01rem solid #a66e4d;
      position: absolute;
      top: 0;
      bottom: 0;
      margin: auto;
    }
    .redWrap .h text.l{
      left: -0.3rem;
    }
    .redWrap .h text.r{
      right: -0.3rem;
    }
    .redWrap .h text::after{
      content: "";
      display: block;
      width: 0.05rem;
      height: 0.05rem;
      border-radius: 0.05rem;
      background: #a66e4d;
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      margin: auto;
    }
    .redWrap .btn{
      background: url(https://dpy01cdn.yixuan.net/images/2/2021/08/O1s6QWtmD6ddQwytdsLyL2ytR9S2yE.png) no-repeat center;
      width: 2.48rem;
      height: 0.64rem;
      background-size: 100% 100%;
      margin: 0 auto;
      color: #cd4e42;
      line-height: 0.64rem;
      text-align: center;
      position: absolute;
      bottom: 0.8rem;
      left: 0;
      right: 0;
    }
    .redWrap .price{
      display: flex;
      justify-content: center;
      align-items: flex-end;
      margin-top: 0.3rem;
    }
    .redWrap .price .num{
      font-size: 1rem;
      line-height: 2rem;
      font-weight: bold;
      color: #ee5f52;
      position: relative;
    }
    .redWrap .price .num::after{
      content: "";
      display: inline-block;
      width: 0.4rem;
    }
    .redWrap .price .num .flag{
      font-size: 0.3rem;
      width: 0.4rem;
      height: 0.4rem;
      line-height: 0.4rem;
      background: #ee5f52;
      color: #ffffff;
      position: absolute;
      bottom: 0.6rem;
      right: 0;
      border-radius: 0.4rem;
      text-align: center;
    }

    .redGetWrap{
      z-index: 1;
      background: url(https://dpy01cdn.yixuan.net/images/2/2021/08/RSQrw87Q4UE6cS41uR8cw6QW4YC8cs.png) no-repeat -0.16rem top;
      background-size: 100% auto;
      position: relative;
      color: #d1302d;
      overflow: hidden;
    }
    .redGetWrap .h{
      margin-top: 1.56rem;
      font-size: 0.40rem;
      text-align: center;
    }
    .redGetWrap .name{
      margin-top: 0.04rem;
      font-size: 0.30rem;
      text-align: center;
    }
    .redGetWrap .price{
      margin-top: 0.04rem;
      display: flex;
      justify-content: center;
      align-items: flex-end;
    }

    .redGetWrap .price .num{
      font-size: 1.10rem;
      line-height: 1.10rem;
      font-weight: bold;
      color: #ee5f52;
      position: relative;
    }
    .redGetWrap .price .num::after{
      content: "";
      display: inline-block;
      width: 0.40rem;
    }
    .redGetWrap .price .num .flag{
      font-size: 0.30rem;
      width: 0.40rem;
      height: 0.40rem;
      line-height: 0.40rem;
      background: #ee5f52;
      color: #ffffff;
      position: absolute;
      bottom: 0.16rem;
      right: 0;
      border-radius: 0.40rem;
      text-align: center;
    }
    .redGetWrap .btn{
      background: #fefaee;
      width: 2.48rem;
      height: 0.70rem;
      border-radius: 0.64rem;
      background-size: 100% 100%;
      margin: 0 auto;
      color: #cd4e42;
      line-height: 0.70rem;
      text-align: center;
      position: absolute;
      bottom: 1.80rem;
      left: 0;
      right: 0;
      font-size: 0.30rem;
    }
    .redGetWrap .anim_txt{
      color: rgba(255,255,255,0.8);
      text-align: center;
      position: absolute;
      bottom: 1.30rem;
      left: 0;
      right: 0;
      font-size: 0.2rem;
      animation: anim_txt 1s infinite;
    }
    .peoInfor{
      font-size: .25rem;
    }
    .peoName{
      width: 1.14rem;
    }
    .small_color{
      background-image:linear-gradient( to right ,rgba(255,119,55,0.37), rgba(249,156,68,0.37)) !important;
    }
    @keyframes anim_txt {
      0%{
        opacity: 0;
      }
      50%{
        opacity: 0;
      }
      51%{
        opacity: 1;
      }
      99%{
        opacity: 1;
      }
      100%{
        opacity: 0;
      }
    }
    .winTxt{
      max-width: 200px;
    }
    .orderList>div{
      overflow: visible;
    }
    .luckyImg img{
      width: 2.82rem !important;
      height: 2.82rem !important;
    }
    .luckyAlt .goPlay{
      margin: .2rem auto 0 !important;
    }
  /*  自定义修改*/
    {if $config['yx_lt_diy_tc']==1}
    .gameBar{
      background: url(http://img2020.yixuansoft.cn/images/2/2023/12/XvVrVEPP0MVqQ7zZVVOvwMmrVv3Mtv.png) center no-repeat;
      background-size: 100% auto;
    }
    @keyframes changeBg
    {
      from { background:url(http://img2020.yixuansoft.cn/images/2/2023/12/XvVrVEPP0MVqQ7zZVVOvwMmrVv3Mtv.png) center no-repeat; background-size:100% auto;}
      30% { background:url(http://img2020.yixuansoft.cn/images/2/2023/12/XvVrVEPP0MVqQ7zZVVOvwMmrVv3Mtv.png) center no-repeat; background-size:100% auto;}
      50% { background:url(http://img2020.yixuansoft.cn/images/2/2023/12/XvVrVEPP0MVqQ7zZVVOvwMmrVv3Mtv.png) center no-repeat; background-size:100% auto;}
      70% { background:url(http://img2020.yixuansoft.cn/images/2/2023/12/XvVrVEPP0MVqQ7zZVVOvwMmrVv3Mtv.png) center no-repeat; background-size:100% auto;}
      to { background:url(http://img2020.yixuansoft.cn/images/2/2023/12/XvVrVEPP0MVqQ7zZVVOvwMmrVv3Mtv.png) center no-repeat; background-size:100% auto;}
    }
    .gameBar span{
      background: url("http://img2020.yixuansoft.cn/images/2/2023/12/wRZGaIVE8M11vVARA61E9I1zv5EiQ5.png") center no-repeat;
      background-size: 100% auto;
    }
    .gameBar span:last-child{
      background: url("http://img2020.yixuansoft.cn/images/2/2023/12/xLQ3drlrcCcccOL933Qrr99CTtLRTo.png") center no-repeat;
      background-size: 100% auto;
    }
    .gameControl{
      background: url("http://img2020.yixuansoft.cn/images/2/2023/12/iDN1dUHNPUyPPJ6nBN6nAU6b24TNAX.png") center no-repeat;
      background-size: 100% auto;
    }
    .winData{
      background: url("http://img2020.yixuansoft.cn/images/2/2023/12/S8HEe3h88zZ8Y8513WLZoulkmhkm33.jpg/99.jpg") center no-repeat;
      background-size: 100% auto;
    }
    .dataChose{
      background: url("http://img2020.yixuansoft.cn/images/2/2023/12/oL8m82RvEAe28e8R3gIA8ZkX24Ra8g.png") center no-repeat;
      background-size: 100% auto;
    }
    .gameControl a{
      /*background: #930000 url(https://css2020.yixuan.net/2020css/plugin/lottery/images/btn3.png) center no-repeat;*/
      background: url(http://img2020.yixuansoft.cn/images/2/2023/12/JVZV8U7L80Dk0ruD6Q1dtE8U2Uz84U.png) center no-repeat;
      border-radius: 0.26rem;
      background-size: 100% auto;
    }
    .giftInfor p{
      color: #ffffff;
    }
    {/if}
  /*  自定义修改*/
  </style>
  <div class="yx_lt" id="yx_lt">

  </div>
<!--  新背景遮罩层-->
  <div id="new_screen" onclick="close_alert" style="display: none">

  </div>
  <style type="text/css">
    #new_screen{
      position: fixed;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background: rgba(0,0,0,0.5);
      z-index:3;
    }
  </style>
<!--  弹出层-->
  <div id="writeInfo" class="yx_altBox" style="display: none;">
    <div class="writeInfo" style="position: relative; padding-top: 1.95rem;background: url(https://css2020.yixuan.net/2020css/plugin/lottery/images/myinfo.png) center no-repeat; width: 6.09rem;height: 7.2rem;background-size: 100% auto;text-align: center;">
      <div style="margin: 0 auto;margin-top:50px;height: 30px;line-height: 30px;font-size:.3rem;color: #af6e27;">领奖姓名：
        <input id="receive_name" name="receive_name" style="width:2.8rem;text-align:center;height: 24px;line-height: 24px;border-radius: 4px;border: 1px solid #af6e27;">
      </div>
      <div style="margin: 0 auto; margin-top:30px;height: 30px;line-height: 30px;font-size:.3rem;color: #af6e27">领奖电话：
        <input id="receive_phone" name="receive_phone" type="tel"  maxlength="11" style="width:2.8rem;text-align:center;height: 24px;line-height: 24px;border-radius: 4px;border: 1px solid #af6e27;">
      </div>
      <a id="receive_btn"  href="javascript:;" onclick="subCusterInfo()" class="backPlay">保存</a>
    </div>
  </div>

<!--  助力弹窗-->
<!--  <style>-->
<!--    .fadein1{-->
<!--      width: 100%;-->
<!--      height: 100%;-->
<!--      background: rgba(0,0,0,0.6);-->
<!--      position: fixed;-->
<!--      left: 0;-->
<!--      top: 0;-->
<!--      display: flex;-->
<!--      align-items: center;-->
<!--      justify-content: center;-->
<!--      z-index: 4;-->
<!--    }-->
<!--    .fadein1 .box{-->
<!--      width: 100vw;-->
<!--      overflow: hidden;-->
<!--      z-index: 6;-->
<!--    }-->
<!--    .fadein1 .box .logos{-->
<!--      width: 1.48rem;-->
<!--      height: 1.48rem;-->
<!--      border-radius: 50%;-->
<!--      padding: .05rem;-->
<!--      background-color: #f7d08e;-->
<!--      margin: 0 auto;-->
<!--      margin-bottom: .16rem;-->
<!--    }-->
<!--    .fadein1 .box .logos img{-->
<!--      width: 100%;-->
<!--      height: 100%;-->
<!--      border-radius: 50%;-->
<!--    }-->
<!--    .fadein1 .box .f{-->
<!--      display: block;-->
<!--      font-size: .45rem;-->
<!--      color: #fff;-->
<!--      text-align: center;-->
<!--      line-height: .67rem;-->
<!--      font-weight: bold;-->
<!--    }-->
<!--    .fadein1 .box .icons{-->
<!--      display: block;-->
<!--      width: 4.46rem;-->
<!--      margin: 0 auto;-->
<!--      margin-top: .30rem;-->
<!--    }-->
<!--    .fadein1 .box .btn{-->
<!--      display: block;-->
<!--      width: 2.54rem;-->
<!--      margin: 0 auto;-->
<!--      margin-top: .10rem;-->
<!--      height: 33px;-->
<!--    }-->
<!--    .fadein1 .box .close1{-->
<!--      display: block;-->
<!--      width: .46rem;-->
<!--      margin: 0 auto;-->
<!--      margin-top: .42rem;-->
<!--      background: url(http://kaifa.yixuan.net/attachment/images/yx_lottery/close.png) center no-repeat;-->
<!--      background-size: 100% auto;-->
<!--    }-->
<!--  </style>-->
<!--<div class="fadein1">-->
<!--  <div class="box">-->
<!--    <div class="logos">-->
<!--      <img src="https://css2020.yixuan.net//2020css/lottery/lottery2022/image/open_07.jpg">-->
<!--    </div>-->
<!--    <div class="f">胡丽红正在参加</div>-->
<!--    <div class="f">100%幸运大奖活动</div>-->
<!--    <img src="https://css2020.yixuan.net//2020css/lottery/lottery2022/image/fadein_03.png" class="icons" mode="widthFix">-->
<!--    <div class="friend_help_todo">-->
<!--      <img src="https://css2020.yixuan.net//2020css/lottery/lottery2022/image/fadein_07.png" class="btn" mode="widthFix">-->
<!--    </div>-->
<!--    <div class="new_close2">-->
<!--      <img src="https://css2020.yixuan.net//2020css/lottery/lottery2022/image/bgs_07.png" class="close1" mode="widthFix" >-->
<!--    </div>-->
<!--  </div>-->
<!--</div>-->

  <script>

    $(document).on('click','#screen',function () {
      $("#show_share").hide();
      $("#redWrap").hide();
      $("#redGetWrap").hide();
      $('.winerAlt,.myWinner').animate({'bottom':'-150%'},500);
      $('#ruleBar,#screen,#mygiftBar,.loseAlt,.noTimesAlt,.getAlt').fadeOut();
    });
    $(function(){
      if($('#screen').length<=0){
        $("#yx_lt").append($('<div id="screen" class="screen"></div>'));
      }
    })
	$('.closeWiner').click(function(){
		$('#screen').fadeOut();
		$('.winerAlt').animate({'bottom':'-150%'},500)
	})
    //助力关闭
    $(document).on('click','.new_close2',function () {
      $(".fadein1").hide();
    });
    $(".friend_help_todo").click(function () {
      console.log('好友点击助力')
    });
  </script>
  <script>
    var is_load = false;
    var used_lt = 0;
    var yx_lt_receive_con = 0;
    $(document).ready(function () {
      // layer.load(0, {shade: false,time:3000});
      loadBaseInfo();
    });
    var t1,t2,t3,t4;
   function RandomNumBoth(Min,Max){
		  var Range = Max - Min;
		  var Rand = Math.random();
		  var num = Min + Math.round(Rand * Range); //四舍五入
		  return num;
	}
	var randomNum = 0;
    var  hasWinning=false;
		var luck={
			index:0,	//当前转动到哪个位置，起点位置
			count:0,	//总共有多少个位置
			timer:0,	//setTimeout的ID，用clearTimeout清除
			speed:20,	//初始转动速度
			times:0,	//转动次数
			cycle:50,	//转动基本次数：即至少需要转动多少次再进入抽奖环节
			prize:0,	//初始化奖品
			init:function(id){
				if ($("#"+id).find(".luck-unit").length>0) {
					$luck = $("#"+id);
					$units = $luck.find(".luck-unit");
					this.obj = $luck;
					this.count = $units.length;
					$luck.find(".luck-unit-"+this.index).addClass("active");
				};
			},
			roll:function(){
				var index = this.index;
				var count = this.count;
				var luck = this.obj;
				$(luck).find(".luck-unit-"+index).removeClass("active");
				index += 1;
				if (index>count-1) {
					index = 0;
				};
				$(luck).find(".luck-unit-"+index).addClass("active");
				this.index=index;
				return false;
			},
			stop:function(index){
				this.prize=index;
				return false;
			}
		};
		function roll(){
			luck.times += 1;
			luck.roll();
			if (luck.times > luck.cycle+10 && luck.prize==luck.index) {
				clearTimeout(luck.timer);
				luck.times=0;
				click=false;
				var prizeNum = luck.prize;
				console.log('中奖号码'+prizeNum)
				//判断中奖号码执行对应方法
				$('.gameBar').removeClass('fastAni');
				if(!hasWinning){
            //未中奖判断
                  clearTimeout(t3);
                  t3 = setTimeout(function () {
                    $('.loseAlt,#screen').fadeIn();
                  },1000);

				}else{
            //中奖后获取中奖信息
                  clearTimeout(t4);
                  t4 = setTimeout(function () {

                    var codeTxt = $('.gameBar span').eq(prizeNum).children().find('p').html();
                    // $('.getBox p').html(codeTxt);
                    var imgSrc =  $('.gameBar span').eq(prizeNum).children().find('img').attr('src');
                    $('.producePic img').attr('src',imgSrc);
                    $('#screen').fadeIn();
                    $('.getAlt').fadeIn();
                  },1000);

				}
			}else{
				if (luck.times<luck.cycle) {
					luck.speed -= 10;
				}else if(luck.times==luck.cycle) {
					var index = randomNum;//设置最终中奖位置
                    luck.prize = index;

				}else{
					if (luck.times > luck.cycle+10 && ((luck.prize==0 && luck.index==7) || luck.prize==luck.index+1)) {
						luck.speed += 100;
					}else{
						luck.speed += 20;
					}
				}
				if (luck.speed<40) {
					luck.speed=40;
				};
				luck.timer = setTimeout(roll,luck.speed);

			}
			return false;
		}
		var click=true;
		var click_msg = '初始化数据中，请稍后 ~~~';
		var canLt = false;
		window.onload=function(){

		};
    var prizeInfo = [];
    var limit_tips = '';
    var ErrorTxt = '';
    function myGet (mywin) {
      $('#redWrap').fadeOut();
      $('#redGetWrap').fadeOut();
      $('.getAlt').fadeOut();
      $('.winerAlt').animate({'bottom':'-150%'},500)

      if (yx_lt_receive_con==2){
        // $("#new_screen").show();
        // $("#writeInfo").show();
        customForm.show();
        return;
      }
      var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","type"=>"default","r"=>"lottery.prize"));}';
      $.ajax({
        type:'POST',
        dataType:'json',
        url:postUrl,
        success:function (res){
          var data = res.data;
          if (res.error) {
            layer.msg(res.msg);
          } else {
            var myWinner_html = data.myWinner_html;
            $(".myWinner").remove();//移除原有的我得奖品的弹窗
            $("#yx_lt").append(decode(myWinner_html));//添加新的元素
            $('#screen').fadeIn();
            if (mywin==1){
              $('.myWinner').show().css({'bottom': 0});
            }else{
              $('.myWinner').animate({'bottom': 0}, 500);
            }
            djs();
          }
        }
      });
    }
    //初始化请求
    function loadBaseInfo() {
      var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.index.post"));}';
      if (!is_load){
        $.ajax({
          type:'POST',
          dataType:'json',
          url:postUrl,
          success:function (res){
            var data = res.data;
            var can_lt = data.can_lt;
            var show_modal_num = data.show_no_chance_num;
            var error_txt = data.error_txt;
            var has_lucky_star = data.has_lucky_star;
            var show_tips = data.show_tips;
            var prize_info = data.prize_info;
            var ruleBtn = data.ruleBtn_html;
            var topBox = data.topBox_html;
            var winData = data.winData_html;
            var ruleBar = data.ruleBar_html;
            var screen = data.screen_html;
            var luckyStar = data.luckyStar_html;
            var noTimesAlt = data.noTimesAlt_html;
            var share_html = data.share_html;
            var mygiftBar_html = data.mygiftBar_html;
            var convert_html = data.convert_html;
            var red_package_modal_html = data.red_package_modal_html;
            var show_chance_tip = data.show_chance_tip;
            var show_my_prize = data.show_my_prize;
            ErrorTxt = data.error_txt;
            limit_tips = data.limit_chance_tips;
            if (error_txt){
              if (error_txt.msg){
                layer.msg(error_txt.msg)
              }else{
                layer.msg(error_txt)
              }

            }
            used_lt = data.used_lt;//不限制 抽奖条件 1已下单可抽奖  2未下单不可抽奖
            yx_lt_receive_con = data.yx_lt_receive_con;//收集客资的条件 1 抽奖前  2抽奖后 0已填写 不需要
            // console.log('抽奖条件'+used_lt);
            // console.log('收集客资的条件'+yx_lt_receive_con);
            $("#yx_lt").append(decode(ruleBtn));
            $("#yx_lt").append(decode(topBox));
            $("#yx_lt").append(decode(winData));
            $("#yx_lt").append(decode(ruleBar));
            $("#yx_lt").append(decode(luckyStar));
            $("#yx_lt").append(decode(noTimesAlt));
            $("#yx_lt").append(decode(mygiftBar_html));
            $("#yx_lt").append(decode(convert_html));
            $("#yx_lt").append(decode(screen));
            $("#yx_lt").append(decode(red_package_modal_html));
            $("#yx_lt").append(decode(share_html));
            if (error_txt){
              $("#btn22").children('div:first').html('');
              if (error_txt.msg){
                $("#notice_chance").html(error_txt.msg);
              }else{
                $("#notice_chance").html(error_txt);
              }

              console.log(123)
            }
            if (show_chance_tip){
              // layer.msg(show_chance_tip);
              layer.confirm(show_chance_tip,{
                btn:['知道了']
              },function (index) {
                layer.close(index)
              })
            }
            prizeInfo = prize_info;
            canLt = can_lt;
            if (!can_lt && show_modal_num>0 && noTimesAlt){
              click_msg = show_tips;
              $('#screen').fadeIn();
              $('.noTimesAlt').fadeIn();
            } else {
              click = false;
              luck.init('luck');
            }
            //存在幸运星
            if (has_lucky_star){
              setTimeout(function () {
                $('#screen').fadeIn();
                $('#luckyStar').fadeIn();
              }, 3000);

            }
            if (show_my_prize){
              myGet();
            }
            djs();
          }
        });
      }
    }
    //客资信息提交
    function subCusterInfo(){
      $("#receive_btn").attr("disabled",true);
      layer.msg('加载中', {
        icon: 16
        ,shade: 0.05
      });
      var receive_name = $("#receive_name").val();
      var receive_phone = $("#receive_phone").val();
      if (receive_name.length<2){
        layer.msg('请填写您的真实姓名');
        return;
      }else if(receive_name.length>10){
        layer.msg('领奖姓名长度限制10位');
        return;
      }else{
        //正则表达式
        var reg = new RegExp("^[A-Za-z0-9\u4e00-\u9fa5]+$");
        //判断输入框中有内容
        if(!reg.test(receive_name))
        {
          layer.msg("请输入中文、数字和英文！");
          return ;
        }
      }
      if (receive_phone.length!=11){
        layer.msg('领奖电话请输入11位手机号码');
        return;
      }
      const regMobile = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
      if (!regMobile.test(receive_phone)) {
        layer.msg('手机号格式输入有误！')
        return;
      }
      var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.index.subUserInfo"));}';
      $.ajax({
        type:'POST',
        dataType:'json',
        data:{receive_name:receive_name,receive_phone:receive_phone},
        url:postUrl,
        success:function (res){
          var data = res.data;
          $("#receive_btn").attr("disabled",false);
          layer.closeAll();
          if (res.error) {
            layer.msg(res.msg);
          } else {
            $("#new_screen").hide();
            $("#writeInfo").hide();
            layer.msg('提交成功');
            yx_lt_receive_con =0;
          }

        }
      });
    }
    //隐藏当前弹出 显示填写信息
    function show_register_info(){
      if (limit_tips){
        layer.msg(limit_tips);
        return;
      }
      $('#screen').fadeOut();
      $('.myWinner').animate({'bottom':'-150%'},500);
      show_info(1);
    }
    //分享图
    function show_share(){
      if (limit_tips){
        layer.msg(limit_tips);
        return;
      }
      $('#screen').fadeOut();
      $('.myWinner').animate({'bottom':'-150%'},500);

      $('#screen').fadeIn();
      $("#show_share").show();
    }
    //助力好友
    function powerFriend() {
      var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.index.power"));}';
      $.ajax({
        type:'POST',
        dataType:'json',
        url:postUrl,
        success:function (res){
          var data = res.data;
          layer.msg(res.msg);
        }
      });
    }
    function helpFriend(e) {
      // if (limit_tips){
      //   layer.msg(limit_tips);
      //   return;
      // }
      let type = e.dataset.type;
      $('#screen').fadeOut();
      $('.myWinner').animate({'bottom':'-150%'},500);
      var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.index.friendHelp"));}';
      $.ajax({
        type:'POST',
        dataType:'json',
        data:{type:type},
        url:postUrl,
        success:function (res){
          var data = res.data;
          if (res.error) {
            layer.msg(res.msg);
          } else {
            var helpBar_html = data.helpBar_html;
            $("#helpBar").remove();//移除原有的我得奖品的弹窗
            $("#yx_lt").append(decode(helpBar_html));//添加新的元素
            $('#screen').fadeIn();
            $('#helpBar').fadeIn();
          }
        }
      });
    }
    //兑换
    function convert(e) {
      if (yx_lt_receive_con==2){
        customForm.show();
        return;
      }
      var item_status = $(e).attr("data-status");
      var item_fid = $(e).attr("data-fid");
      if (item_status==1 || item_status==3) {
        var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.convert"));}';
        $.ajax({
          type:'POST',
          dataType:'json',
          data:{f_id:item_fid},
          url:postUrl,
          success:function (res){
            var data = res.data;
            if (res.error) {
              layer.msg(res.msg);
            } else {
              $('#screen').fadeOut();
              $('.myWinner').animate({'bottom':'-150%'},500);

              $(".convert_prize_img").attr("src", data.prize_img);
              $(".convert_title").html(data.title);
              $(".convert_prize_name").html(data.prize_name);
              $("#verif_img").attr('src',data.convert_card);
              $(".convert_method").html(data.method);
              $(".convert_people").html(data.tel);
              $(".convert_tel").html(data.mobile);
              $("#convert_btn_txt").html(data.btn_txt);

              $("#convert_btn_txt").data("fid", item_fid);
              $("#convert_btm_tips").html(data.btm_tips);
              $("#convert_btm_tips2").html(data.btm_tips2);

              $('#screen').fadeIn();
              $('.winerAlt').animate({'bottom':0},500);
            }
          }
        });
      }
    }
    //倒计时
    function djs(){
      $(".yx_yomibox").each(function(){
        var data="";
        var enddata = "";
        var _DOM=null;
        var TIMER;
        // $(this).parent(".stratTag").width("2.8rem")
        $(this).parent(".stratTag").prev().css("cssText", "width:2.7rem !important;");
        createdom =function(dom){
          _DOM=dom;
          data=$(dom).attr("data");
          enddata=$(dom).attr("end_data");
			// data="2021-08-15 20:10";//测试功能
          data = data.replace(/-/g,"/");
          data = Math.round((new Date(data)).getTime()/1000);
          today = Math.round((new Date()).getTime()/1000);
          // if (data>0){
          //   $(_DOM).html("<span class='yomihour'></span><span class='split'>:</span><span class='yomimin'></span>")
          // }
          if($(dom).attr("data"))reflash();
          return TIMER;

        };
        reflash=function(){
          var	range  	= data-Math.round((new Date()).getTime()/1000);
          if(range <=0){
            getchange();
            range = data-Math.round((new Date()).getTime()/1000);
          }
          if(range <=0){
            $(_DOM).parent(".stratTag").html("<div class='yx_yomibox mobile_color'>去领取</div>");
            clearInterval(TIMER);
            $('.dalin_time').hide();
            $(".allend_timer").show();
          }
          var			secday = 86400, sechour = 3600,
                  // days 	= parseInt(range/secday),
                  hours	= parseInt((range)/sechour),
                  min		= parseInt(((range%secday)%sechour)/60),
                  sec		= ((range%secday)%sechour)%60;
          $(_DOM).html("<span class='yomihour'>"+nol(hours)+"</span><span class='split'>:</span><span class='yomimin'>"+nol(min)+"</span><span class='split'>:</span><span class='yomisec'>"+nol(sec)+"</span>");



        };

        getchange = function(){
          if (enddata != undefined){
            enddata = enddata.replace(/-/g,"/");
            data = Math.round((new Date(enddata)).getTime()/1000);
            $(".timenow").hide();
            $(".timeover").show();
          }
        };

        if($(this).attr("data"))TIMER = setInterval( reflash,1000 );
        nol = function(h){
          return h>9?h:'0'+h;
        }
        var $box = $(this);
        createdom($box);
      });
    }

    //关闭
    $("#new_screen").click(function () {
      $("#writeInfo").hide();
      $("#new_screen").hide();
    });
    //后追加元素的点击事件在此
	$(function(){
      $(".yx_yomibox").each(function(){
			$(this).yomi();
		});
      //抽奖点击
      $('.yx_lt').on('click','#btn22',function () {

        if (ErrorTxt){
          if (ErrorTxt.msg){
            layer.msg(ErrorTxt.msg);
          }else{
            layer.msg(ErrorTxt);
          }

          return ;
        }
        if (used_lt==2){
          layer.msg('请抢购后再进行抽奖');
          return ;
        }
        if (yx_lt_receive_con==1){
          // $("#new_screen").show();
          // $("#writeInfo").show();
          customForm.show();
          return ;
        }
        $('.gameBar').addClass('fastAni');
        if(!canLt) {
          // layer.msg(click_msg);
          var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","type"=>"chance","r"=>"lottery.prize"));}';
          $.ajax({
            type:'POST',
            dataType:'json',
            url:postUrl,
            success:function (res){
              var data = res.data;
              if (res.error) {
                layer.msg(res.msg);
              } else {
                var myWinner_html = data.myWinner_html;
                $(".myWinner").remove();//移除原有的我得奖品的弹窗
                $("#yx_lt").append(decode(myWinner_html));//添加新的元素
                $('#screen').fadeIn();
                $('.myWinner').animate({'bottom':0},500)
              }
            }
          });
          return false;
        } else if (!click && canLt) {

          $('#btn22').attr("disabled",true);
          $("#notice_chance").html('正在抽奖');
          click = true;
          click_msg = '操作过于频繁，请稍后操作!';
          var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.getone"));}';
          $.ajax({
            type:'POST',
            dataType:'json',
            url:postUrl,
            success:function (res){
              var data = res.data;
              var can_lt = data.can_lt;
              var error_txt = data.error_txt;
              var remain_num = data.remain_num;
              var show_tips = data.show_tips;
              var getAlt = decode(data.getAlt_html);
              var loseAlt = decode(data.loseAlt_html);
              var has_info = data.has_info;
              var lose_info = data.lose_info;
              var has_winning = data.has_winning;
              var myWinner_html = data.myWinner_html;
              $(".myWinner").remove();//移除原有的我得奖品的弹窗
              $("#yx_lt").append(decode(myWinner_html));//添加新的元素
              if (error_txt) {
                layer.msg(error_txt);
                window.location.reload();
              }
              if (getAlt && has_winning) {
                clearTimeout(t1);
                $(".getAlt").remove();
                hasWinning = true;
                randomNum = has_info.checked_key;
                luck.speed=100;
                roll();
                t1 = setTimeout(function () {
                  if (has_info.type!='default'){
                    $(".redGetWrap").children(".price").find(".p").html(has_info.amount);
                    $("#redGetWrap").fadeIn();
                    $('#screen').fadeIn();
                    $("#notice_chance").html(show_tips);
                  }else{
                    $("#yx_lt").append(getAlt);
                    $("#notice_chance").html(show_tips);
                  }
                },4800)


              }
              if (loseAlt && !has_winning) {
                clearTimeout(t2);
                $(".loseAlt").remove();
                hasWinning = false;
                randomNum = lose_info.checked_key;
                luck.speed=50;
                roll();

                t2 = setTimeout(function () {
                  // $('#screen').fadeIn();
                  $("#yx_lt").append(loseAlt);
                  // $('.loseAlt').fadeIn();
                  click = false;
                  $('#btn22').removeAttr("disabled");
                  $("#notice_chance").html(show_tips);
                },4800)

              }

              canLt = can_lt;
              if (!can_lt){
                click_msg = show_tips;
                return;
              } else {

              }

            }
          });
        }
      });
      //兑换隐藏
      $('.yx_lt').on('click','.closeWiner',function () {
        $('#screen').fadeOut();
        $('.winerAlt').animate({'bottom':'-150%'},500)
      });
      $('.yx_lt').on('click','#screen',function () {
        console.log('关闭背景框')
        $("#show_share").hide();
        $("#redWrap").hide();
        $("#redGetWrap").hide();
        $('#screen,#mygiftBar').fadeOut();
      });
      //弹窗关闭
      $('.yx_lt').on('click','.close,.iknowBtn',function () {
        $('#helpBar').fadeOut();
        $(this).parent().fadeOut();
        $("#redWrap").hide();
        $("#redGetWrap").hide();
        $('#ruleBar,#screen,#mygiftBar,.loseAlt,#luckyStar,.noTimesAlt,.getAlt').fadeOut();
      });
      //幸运星
      $('.yx_lt').on('click','.goPlay',function () {
        $("#luckyStar").fadeOut();
        $('#screen').fadeOut();
        $('#helpBar').fadeOut();
        window.location.href = "#yx_lt";
      });
      $('.yx_lt').on('click','.backPlay',function () {
        $('#mygiftBar').fadeOut();
        $('#redWrap').fadeOut();
        $('#redGetWrap').fadeOut();
        $('#screen').fadeOut();
        // window.location.href= "#yx_lt";
      });
      //记录攻略切换
      $('.yx_lt').on('click','.dataChose span',function(){
                var num = $(this).index();
                if(num==0){
                  $('.dataChose').removeClass('cur')
                }else{
                  $('.dataChose').addClass('cur')
                }
                $(this).addClass('cur').siblings().removeClass('cur');
                $('.yx_choseBox .yx_choseBar').eq(num).fadeIn().siblings().hide();
                console.log('点击切换')
                $.fn.yomi=function(){
                  console.log('倒计时1')
                  var data="";
                  var enddata = "";
                  var _DOM=null;
                  var TIMER;
                  createdom =function(dom){
                    _DOM=dom;
                    data=$(dom).attr("data");
                    console.log('倒计时3:'+data);
                    enddata=$(dom).attr("end_data");

                    data = data.replace(/-/g,"/");
                    console.log(data)
                    data = Math.round((new Date(data)).getTime()/1000);
                    // $(_DOM).append("<span class='yomihour'></span><span class='split'>:</span><span class='yomimin'></span>")
                    if($(dom).attr("data"))reflash();
                    return TIMER;

                  };
                  reflash=function(){
                    var	range  	= data-Math.round((new Date()).getTime()/1000);
                    if(range <=0){
                      getchange();
                      range = data-Math.round((new Date()).getTime()/1000);
                    }
                    if(range <=0){
                      $(_DOM).parent(".stratTag").html("<div class='yx_yomibox mobile_color'>去领取</div>");
                      clearInterval(TIMER);
                      $('.dalin_time').hide();
                      $(".allend_timer").show();
                    }
                    var			secday = 86400, sechour = 3600,
                            // days 	= parseInt(range/secday),
                            hours	= parseInt((range)/sechour),
                            min		= parseInt(((range%secday)%sechour)/60),
                            sec		= ((range%secday)%sechour)%60;
                    $(_DOM).html("<span class='yomihour'>"+nol(hours)+"</span><span class='split'>:</span><span class='yomimin'>"+nol(min)+"</span><span class='split'>:</span><span class='yomisec'>"+nol(sec)+"</span>");

                  };

                  getchange = function(){
                    if (enddata != undefined){
                      enddata = enddata.replace(/-/g,"/");
                      data = Math.round((new Date(enddata)).getTime()/1000);
                      $(".timenow").hide();
                      $(".timeover").show();
                    }
                  };

                  if($(this).attr("data"))TIMER = setInterval( reflash,1000 );
                  nol = function(h){
                    return h>9?h:'0'+h;
                  }
                  this.each(function(){
                    console.log(123123)
                    var $box = $(this);

                    // $(this).parent(".stratTag").width("2.8rem")
                    $(this).parent(".stratTag").prev().css("cssText", "width:2.7rem !important;");
                    createdom($box);
                  });
                }
      });
      //游戏规则弹出
      $('.yx_lt').on('click','.ruleBtn',function () {
        $('#ruleBar,#screen').fadeIn();
      });

      //我的奖品弹出
      $('.yx_lt').on('click','.myGet,#convert_btn_txt,.convert_btn_txt',myGet);
      $('.yx_lt').on('click','#screen,.screen',function () {
        $('.myWinner').animate({'bottom':'-150%'},500)
        $('#screen').fadeOut();
      });
      //更多机会
      $('.yx_lt').on('click','.moreChance',function () {
        var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","type"=>"chance","r"=>"lottery.prize"));}';
        $.ajax({
          type:'POST',
          dataType:'json',
          url:postUrl,
          success:function (res){
            var data = res.data;
            if (res.error) {
              layer.msg(res.msg);
            } else {
              var myWinner_html = data.myWinner_html;
              $(".myWinner").remove();//移除原有的我得奖品的弹窗
              $("#yx_lt").append(decode(myWinner_html));//添加新的元素
              $('#screen').fadeIn();
              $('.myWinner').animate({'bottom':0},500)
            }
          }
        });
      });
      //我的奖品隐藏
      $('.yx_lt').on('click','.winClose,.continue',function () {
        $('.myWinner').animate({'bottom':'-150%'},500)
        $('#screen').fadeOut();
        location.href='#luck';
      });
      //好友助力
      $('.yx_lt').on('click','.helpFriend',function () {
        var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.index.friendHelp"));}';
        $.ajax({
          type:'POST',
          dataType:'json',
          url:postUrl,
          success:function (res){
            var data = res.data;
            if (res.error) {
              layer.msg(res.msg);
            } else {
              var helpBar_html = data.helpBar_html;
              $("#helpBar").remove();//移除原有的我得奖品的弹窗
              $("#yx_lt").append(decode(helpBar_html));//添加新的元素
              $('#screen').fadeIn();
              $('#helpBar').fadeIn();
            }
          }
        });
      });
      //我的奖品切换
      $('.yx_lt').on('click','.winnerChose span',function () {
        var num = $(this).index();
        if(num==0){
          $('.winnerChose').addClass('cur1').removeClass('cur3')
        }else if(num==2){
          $('.winnerChose').addClass('cur3').removeClass('cur1')
        }else{
          $('.winnerChose').removeClass('cur3').removeClass('cur1')
        }
        $(this).addClass('cur').siblings().removeClass('cur');
        $('.winerChosen .yx_choseBar').eq(num).fadeIn().siblings().hide();
      });
      //定时领取
      $('.yx_lt').on('click','.timeEnd12',function () {
        if (limit_tips){
          layer.msg(limit_tips);
          return;
        }
        var type = $(this).data('type');
        var t_id = $(this).data('otherid');
        var status = $(this).data('status');
        if (type=='timeset' && status ==4) {
          var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.index.getTimeset"));}';
          $.ajax({
            type:'POST',
            dataType:'json',
            data:{t_id:t_id,type:type,status:status},
            url:postUrl,
            success:function (res){
              var data = res.data;
              if (res.error) {
                layer.msg(res.msg);
              } else {
                layer.msg('成功领取定时任务抽奖机会',{
                  icon:1,
                  time:3000
                },function () {
                  window.location.reload();
                });
              }
            }
          });
        }
      });
      //转盘奖品点击
      $('.yx_lt').on('click','.luck-unit',function () {
        var key = $(this).data('key');
        var type = $(this).data('type');
        console.log(type);
        var item = prizeInfo[key];
        console.log(item)
        if (type=='default'){
          if (item && item.default_type!=2) {
            $(".gifPicture img").attr("src", item.icon);
            if (item.name==item.title){
              $('.myGift_h2').html('<span></span>'+" "+item.title);
            }else{
              $('.myGift_h2').html('<span>'+item.name+'</span>'+" "+item.title);
            }
            // $('.myGift_h2').html('<span>'+item.name+'</span>'+" "+item.title);
            $(".myGift_p").html(item.desc);
            $(".backPlay").html('快去抽奖');
            $('#screen').fadeIn();
            $('#mygiftBar').fadeIn();
          }
        }else{
          if (item && item.default_type!=2) {
            $(".redWrap").children(".price").find(".p").html(item.amount);
            $("#redWrap").show();
            $('#screen').fadeIn();
          }
        }


      });
      //红包兑换
      $('.yx_lt').on('click','#convert_red_pack',function () {
        var cando = $("#convert_red_pack").data('cando');
        if (cando){
          var postUrl = '/{php echo createMobileUrl("wx",array("themeid"=>$themeid,"from"=>"mobile","r"=>"lottery.withdraw"));}';
          $.ajax({
            type:'POST',
            dataType:'json',
            url:postUrl,
            success:function (res){
              var data = res.data;
              if (res.error) {
                layer.msg(res.msg);
              } else {
                myGet(1);
                layer.msg('提现成功');
              }
            }
          });
        }
      });
	});
 </script>
</html>
